

import { TweenType } from "../../misc/TweenType";
import ActionBaseTask from "./ActionBaseTask";

const { ccclass, property, menu } = cc._decorator;

@ccclass
@menu("动作任务/JumpBy")
export default class JumpByTask extends ActionBaseTask {
    
    @property({ override: true, visible: false })
    easeType: TweenType = TweenType.linear;

    @property({ displayName: "循环次数", tooltip: "无限循环就把数字设大一点" })
    repeatTime = 1;

    @property({ displayName: "坐标参数" })
    jumpByVec: cc.Vec2 = cc.v2(0, 0);

    @property()
    height = 0;

    getAction() {
        return cc.tween(this.node)
            .repeat(this.repeatTime,
                cc.tween(this.node)
                    .parallel(
                        this.getPlayAudioTween(),
                        cc.jumpBy(this.actionDuration, this.jumpByVec, this.height, 1))
            );
    }
}
